<?php
/**
 * Created by PhpStorm.
 * User: iceberg
 * Date: 2018-10-15
 * Time: 23:09
 */

namespace app\validate;


use think\Validate;

class GoodsValidate extends Validate
{
    protected $rule = [
        'order_id'          =>  'require|number',
        'category_id'       =>  'require|number',
        'unit_id'           =>  'require|number',
        'supplier_id'       =>  'require|number',
        'price'             =>  'float',
        'num'               =>  'number',
        'desc'              =>  'max:100',
    ];

    protected $message  =   [
        'order_id.require'          =>  '订单号必填',
        'order_id.number'           =>  '订单格式必须为数字',
        'category_id.require'       =>  '类别必填',
        'category_id.number'        =>  '类别格式必须为数字',
        'unit_id.require'           =>  '单位必填',
        'unit_id.number'            =>  '单位格式必须为数字',
        'supplier_id.require'       =>  '供应商必填',
        'supplier_id.number'        =>  '供应商格式必须为数字',
        'price.float'               =>  '单价格式错误',
        'num.number'                =>  '数量格式错误',
        'desc.max'                  =>  '备注最多不能超过100个字符',
    ];
}